package com.hxc.controller;

import com.hxc.entity.JobOption;
import com.hxc.entity.Result;
import com.hxc.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 数据统计
 * */
@Slf4j
@RequestMapping("/report")
@RestController
public class ReportController {
    @Autowired
    private ReportService reportService;
    /**
     * 统计各职位员工人数
     * */
    @GetMapping("/empJobData")
    public Result getEmpCountByJob() {
        log.info("开始统计各职位员工人数");
        JobOption jobOption = reportService.getEmpCountByJob();
        return Result.success(jobOption);
    }
    /**
     * 统计各性别职工人数
     * */
    @GetMapping("/empGenderData")
    public Result getEmpCountByGender() {
        log.info("开始统计各性别员工人数");
        List<Map>  maps = reportService.getEmpCountByGender();
        return Result.success(maps);
    }
    /**
     * 统计各学历层次的学员人数
     * */
    @GetMapping("/studentDegreeData")
    public Result getStudentCountByDegree() {
        List<Map> maps = reportService.getStudentCountByDegree();
        return Result.success(maps);
    }
    /**
     * 统计每个班级的人数
     * */
    @GetMapping("/studentCountData")
    public Result getStudentCountByClazz() {
        log.info("请求查询各班级人数");
        Map<String,List> maps = reportService.getStudentCountByClazz();
        return Result.success(maps);
    }

}
